<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% String context = request.getContextPath(); %>
<html>
<head>
	<title>工作页面</title>
	<link rel="stylesheet" href="<%=context %>/Source/lib/layui/css/layui.css">
	<%--<link rel="stylesheet" type="text/css" href="<%=context %>/Source/lib/ligerUI/skins/ligerui-icons.css" />--%>
	<%--<link rel="stylesheet" type="text/css" href="<%=context %>/Source/lib/ligerUI/skins/Aqua/css/ligerui-all.css" />--%>
	<style type="text/css">
		.bodytable0 td div{float: left;}
	</style>
</head>
<body style="margin: 0;">
<div id="form1" class="layui-form" style="margin-right: 50px;margin-top: 30px">
	<input id="processId" type="hidden"/>
	<div class="layui-form-item">
		<label class="layui-form-label">流程</label>
		<div class="layui-input-block">
			<select id="process" name="process">
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">页面类型</label>
		<div class="layui-input-block">
			<select id="pageType" name="pageType">
				<option value="1">查看页面</option>
				<option value="2">编辑页面</option>
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">页面地址</label>
		<div class="layui-input-block">
			<input id="pageUrl" name="pageUrl" type="text" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">页面名称</label>
		<div class="layui-input-block">
			<input id="pageName" name="pageName" type="text" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">页面宽度</label>
		<div class="layui-input-block">
			<input id="pageWidth" name="pageWidth" type="text" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">页面高度</label>
		<div class="layui-input-block">
			<input id="pageHeight" name="pageHeight" type="text" class="layui-input">
		</div>
	</div>
</div>
</body>
<script src="<%=context %>/gooflow/jquery.min.js"></script>
<%--<script src="<%=context %>/Source/lib/ligerUI/js/ligerui.all.js"></script>--%>
<script src="<%=context %>/Source/lib/layui/layui.js"></script>
<script type="text/javascript">
    var path = '<%=context %>';
    var _path = path+"/flow/workPage";
    var _entity_path = path+"/flow/processEntity";
    var tmp_app_id;
    var processList = ${processList};
    var process = ${process};
    $(function () {
        $("#process").empty();
        $("#process").append('<option value="">--请选择--</option>');
        $.each(processList,function(index,obj){
            $("#process").append('<option value="'+obj.processKey+'">'+obj.processName+'</option>');
        });
        // $("#process").ligerComboBox({"width":177});
        // $("#pageType").ligerComboBox({"width":177});

        if(process){
            // console.log(process);
            $("#processId").val(process.id);
            $("#process").val(process.processId);
            $("#pageType").val(process.pageType);
            $("#pageName").val(process.pageName);
            $("#pageUrl").val(process.pageUrl);
            $("#pageWidth").val(process.pageWidth);
            $("#pageHeight").val(process.pageHeight);
        }

        tmp_app_id = "${workPage.appModule.id}";
        $("#appId").val("${workPage.appModule.id}");
        $("#appName").val("${workPage.appModule.name}");
        // appChange();

        $("#entityId").val("${workPage.processEntity.id}");
        $("#entityName").val("${workPage.processEntity.entityName}");

        // $("#mainForm").ligerForm({validate: true});

    });

    //删除ligerComboBox事件重新绑定
    function appChange(){
        $('#entityName').unbind("ligerComboBox");
        $("#entityId").val("");
        $("#entityName").val("");
        $("#entityName").ligerComboBox({
                url: _entity_path + '/getComboBoxData?appId=' + tmp_app_id,
                valueField: 'id',
                textField: 'entityName',
                valueFieldID: 'entityId',
                selectBoxWidth: 180,
                selectBoxHeight: 240,
                width: 180,
                cancelable: false,
                renderItem: function (e) {
                    var data = e.data;
                    var out = [];
                    out.push('<div>' + data.entityName + '</div>');
                    return out.join('');
                }
            }
        );
    }

    function getData() {
        var Data = {
            "id":$("#processId").val(),
            "processId":$("#process").val(),
            "pageType":$("#pageType").val(),
            "pageName":$("#pageName").val(),
            "pageUrl":$("#pageUrl").val(),
            "pageWidth":$("#pageWidth").val(),
            "pageHeight":$("#pageHeight").val()
        };
        return JSON.stringify(Data)
    }

    var form;
    layui.use('form', function(){
        form = layui.form;
        form.render('select');

    });
</script>
</html>
